import 'package:flutter/material.dart';
import '../../utils/navigator_utils.dart';

import 'widget_3_1_state.dart';
import 'widget_3_2_text.dart';
import 'widget_3_3_button.dart';
import 'widget_3_4_image_icon.dart';
import 'widget_3_5_switch_checkBox.dart';
import 'widget_3_6_input.dart';
import 'widget_3_7_form.dart';
import 'widget_3_8_indicator.dart';

// 第三章  路由管理
class ThreeRoute extends StatefulWidget {
  @override
  _ThreeRouteState createState() => new _ThreeRouteState();
}

class _ThreeRouteState extends State<ThreeRoute> {
  // 组件
  List<Widget> _wls;

  @override
  void initState() {
    super.initState();
    _wls = [
      RaisedButton(
          child: Text("状态管理"),
          onPressed: () => NavigatorUtil.goPageByPush(context, new StateRoute())),
      RaisedButton(
          child: Text("文本、字体样式"),
          onPressed: () => NavigatorUtil.goPageByPush(context, new TextRoute())),
      RaisedButton(
          child: Text("按钮"),
          onPressed: () => NavigatorUtil.goPageByPush(context, new ButtonRoute())),
      RaisedButton(
          child: Text("图片和Icon"),
          onPressed: () => NavigatorUtil.goPageByPush(context, new ImageIconRoute())),
      RaisedButton(
          child: Text("单选框和复选框"),
          onPressed: () => NavigatorUtil.goPageByPush(context, new SwitchAndCheckBoxTestRoute())),
      RaisedButton(
          child: Text("输入框"),
          onPressed: () => NavigatorUtil.goPageByPush(context, new InputTestRoute())),
      RaisedButton(
          child: Text("表单"),
          onPressed: () => NavigatorUtil.goPageByPush(context, new FormTestRoute())),
      RaisedButton(
          child: Text("进度条"),
          onPressed: () => NavigatorUtil.goPageByPush(context, new IndicatorRoute())),
    ];
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("第三章：基础组件"),
      ),
      body: Container(
        margin: EdgeInsets.only(left: 20.0),
        child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: _wls),
      ),
    );
  }
}
